package nullby.yoga.activity;

import nullby.yoga.R;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.View.OnTouchListener;
import android.view.ViewGroup;
import android.widget.TextView;

public class HelpActivity extends DialogFragment implements OnTouchListener {
	private static final String TAG = HelpActivity.class.getSimpleName();

	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return inflater.inflate(R.layout.dialog, null, false);
	}

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setStyle(STYLE_NO_TITLE, getTheme());

	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
		getView().setOnTouchListener(this);
		if (!getArguments().getString("title").isEmpty()) {
			TextView ti = (TextView) getView().findViewById(R.id.title);
			ti.setVisibility(View.VISIBLE);
			ti.setText(getArguments().getString("title"));
			ti.setOnTouchListener(this);
		}
		TextView t = (TextView) getView().findViewById(R.id.text);
		t.setText(getArguments().getString("text"));
		t.setOnTouchListener(this);

	}

	// @Override
	// protected void onCreate(Bundle savedInstanceState) {
	// super.onCreate(savedInstanceState);
	// setContentView(R.layout.help);
	// initView();
	// }

	@Override
	public boolean onTouch(View v, MotionEvent event) {
		if (event.getAction() == MotionEvent.ACTION_DOWN) {
			dismiss();
		}
		return false;
	}

	// @Override
	// protected void initView() {
	// tvPoseName = (TextView) findViewById(R.id.tvPoseName);
	// tvPoseName.setText(("".equals(getIntent().getStringExtra(
	// Extra.POSE_NAME))) ? getIntent()
	// .getStringExtra(Extra.POSE_DESCRIPTION).substring(0, 20)
	// .concat("...") : getIntent().getStringExtra(Extra.POSE_NAME));
	//
	// tvPoseDescription = (TextView) findViewById(R.id.tvPoseDescription);
	// tvPoseDescription.setText(getIntent().getStringExtra(
	// Extra.POSE_DESCRIPTION));
	//
	// bBack = (ImageButton) findViewById(R.id.bBack);
	// bBack.setOnClickListener(this);
	// }
	//
	// @Override
	// public void onClick(View v) {
	// switch (v.getId()) {
	// case R.id.bBack:
	// finish();
	// // Intent intent = new Intent(HelpActivity.this,
	// // TrainingActivity.class);
	// //
	// // intent.putExtra(Extra.PATH_DIKTOR,
	// // getIntent().getStringExtra(Extra.PATH_DIKTOR));
	// // intent.putExtra(Extra.PATH_SONG,
	// // getIntent().getStringExtra(Extra.PATH_SONG));
	// // intent.putExtra(Extra.TIME_PROGRAMM,
	// // getIntent().getStringExtra(Extra.TIME_PROGRAMM));
	// // intent.putCharSequenceArrayListExtra(Extra.POSITION, getIntent()
	// // .getCharSequenceArrayListExtra(Extra.POSITION));
	// // startActivity(intent);
	// break;
	//
	// default:
	// break;
	// }
	//
	// }
}
